package com.liyujie.splitscreen.ui.home.adapter;

import android.view.LayoutInflater;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.RecyclerView;

import com.liyujie.splitscreen.R;
import com.liyujie.splitscreen.databinding.ItemDialogDisplayManagerBinding;

import java.nio.charset.StandardCharsets;
import java.util.List;

public class DifferentDisplayAdapter extends RecyclerView.Adapter<DifferentDisplayAdapter.ItemViewHolder> {

    private List<String> stringList;

    public List<String> getStringList() {
        return stringList;
    }

    public void setStringList(List<String> stringList) {
        this.stringList = stringList;
        notifyDataSetChanged();
    }

    @NonNull
    @Override
    public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        ItemDialogDisplayManagerBinding binding = DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.item_dialog_display_manager, parent, false);
        return new ItemViewHolder(binding);
    }

    @Override
    public void onBindViewHolder(@NonNull ItemViewHolder holder, int position) {
        String string= stringList.get(position);

        holder.binding.BatchNumberBindingEntityId.setText(string + "位置");
    }

    @Override
    public int getItemCount() {
        return null == stringList ? 0 : stringList.size();
    }

    public class ItemViewHolder extends RecyclerView.ViewHolder {
        ItemDialogDisplayManagerBinding binding;
        public ItemViewHolder(@NonNull ItemDialogDisplayManagerBinding binding) {
            super(binding.getRoot());
            this.binding = binding;
        }
    }
}
